package net.qiqbframework.differing;

import lombok.extern.slf4j.Slf4j;
import net.qiqbframework.commandhandling.CommandMessage;
import net.qiqbframework.modelling.command.AggregateHandlingMonitor;

@Slf4j
public class DiffLogAggregateHandlingMonitor implements AggregateHandlingMonitor {

    @Override
    public <T> void beforeHandle(CommandMessage<?> commandMessage, T beforeHandleAggregateRoot) {

    }

    @Override
    public <T> void afterCommit(CommandMessage<?> commandMessage, T beforeHandleAggregateRoot, T afterHandleAggregateRoot) {
        // final String diffLog = javersDifferences.diffLog(beforeHandleAggregateRoot, afterHandleAggregateRoot);

        log.info("执行命令[{}]执行后，影响聚合日志:{},{}", commandMessage.getCommandName(), beforeHandleAggregateRoot, afterHandleAggregateRoot.toString());
    }

}
